//         https://ac.nowcoder.com/acm/contest/11218/C





#include <vector>
#include <iostream>
#include <queue>
using namespace std;

int main()
{
    int n, k, x;
    cin >> n >> k;
    priority_queue<int, vector<int>, greater<int> > a;
    while (n--)
    {
        cin >> x;
        if (x > k)
            continue;
        else
            a.push(x);
    }
    int ans = 0;
    while (k > 0)
    {
        int z = a.top();
        k -= z;
        a.pop();
        a.push(z * 2);
        ans++;
    }
    cout << ans - 1 << endl;
    return 0;
}